using System;

namespace Voodoo.Sauce.Internal.Analytics
{
	public class VoodooTuneAbTestAnalyticsInfo
	{
		public readonly string AbTestUuid;

		public readonly string AbTestCohortUuid;

		public readonly string AbTestVersionUuid;

		public VoodooTuneAbTestAnalyticsInfo(string abTestUuid, string abTestCohortUuid, string abTestVersionUuid)
		{
			AbTestUuid = abTestUuid;
			AbTestCohortUuid = abTestCohortUuid;
			AbTestVersionUuid = abTestVersionUuid;
		}

		public VoodooTuneAbTestAnalyticsInfo(string abTestUuid, string abTestCohortUuid)
		{
			AbTestUuid = abTestUuid;
			AbTestCohortUuid = abTestCohortUuid;
			AbTestVersionUuid = "";
		}

		public override bool Equals(object obj)
		{
			if (obj is VoodooTuneAbTestAnalyticsInfo voodooTuneAbTestAnalyticsInfo && IsSameValue(AbTestUuid, voodooTuneAbTestAnalyticsInfo.AbTestUuid))
			{
				return IsSameValue(AbTestCohortUuid, voodooTuneAbTestAnalyticsInfo.AbTestCohortUuid);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return Convert.ToInt32((AbTestUuid + "_" + AbTestCohortUuid).GetHashCode());
		}

		private static bool IsSameValue(string oldValue, string newValue)
		{
			string obj = (string.IsNullOrEmpty(oldValue) ? null : oldValue);
			string text = (string.IsNullOrEmpty(newValue) ? null : newValue);
			return obj == text;
		}

		public override string ToString()
		{
			return AbTestUuid + " - " + AbTestCohortUuid + " - " + AbTestVersionUuid;
		}
	}
}
